package com.koron.system.staff.mapper;

import com.koron.bean.query.PageQuery;
import com.koron.bean.system.org.OrgBean;
import com.koron.bean.system.org.OrgVo;
import com.koron.bean.system.role.RoleStaffBean;
import com.koron.bean.system.staff.StaffBean;
import com.koron.bean.system.staff.dto.OutStaffBean;
import com.koron.bean.system.staff.dto.StaffBeanDto;
import com.koron.bean.system.staff.po.AppUserPo;
import com.koron.bean.system.staff.vo.AppUserVo;
import com.koron.bean.system.staff.vo.EamUser;
import com.koron.system.staff.bean.WorkFlowUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface StaffMapper {

    int insert(AppUserPo staffBean);

    int update(AppUserPo staffBean);

    int delete(String id);

    int deleteIds(@Param("ids") List<String> ids);

    int softDelete(String id);

    int softDeleteIds(@Param("ids") List<String> ids);

    List<String> queryExistList(@Param("accounts") List<String> accounts);

    int batchInsert(@Param("userPos") List<AppUserPo> userPos);

    List<StaffBean> queryStaffListByOrg(@Param("cascadeQuery") Integer cascadeQuery, @Param("staffBean") StaffBeanDto staffBeanDto);

    Long queryStaffListByOrgCount(@Param("cascadeQuery") Integer cascadeQuery, @Param("staffBean") StaffBean staffBean);

    List<AppUserVo> queryStaffListByOrgWithMerge(@Param("cascadeQuery") Integer cascadeQuery, @Param("staffBean") StaffBean staffBean, @Param("queryBean") PageQuery pageQuery, @Param("orgIdlist") List<String> orgIdlist);

    Long queryStaffListByOrgWithMergeCount(@Param("cascadeQuery") Integer cascadeQuery, @Param("staffBean") StaffBean staffBean);

    //根据账号信息查询用户的权限等等信息
    EamUser queryStaffInfoAccount(@Param("account") String account, @Param("orgId") String orgId);

    /**
     * 查询工作流用户
     *
     * @return
     */
    List<WorkFlowUser> getWorkFlowUserList();

    StaffBean verifyAccount(OutStaffBean bean);

    List<String> queryAccountByStaffOrOrgList(@Param("list1") List<RoleStaffBean> list1, @Param("list2") List<RoleStaffBean> list2);

    int resetPy(@Param("list") List<StaffBean> listByOrg);

    StaffBean queryStaffInfo(StaffBean staffBean);

    OrgBean queryDeptByOrgId(String orgId);

    int resetPw(@Param("account") String account, @Param("password") String password);

    List<String> queryAccountListByUserIds(@Param("ids") List<String> ids);

    AppUserVo queryStaffInfoWithMerge(String account);

    List<OrgVo> queryOrgVoListByAccount(String account);

    int clearDefaultAppId(String defaultAppId);
}
